<!DOCTYPE html>
<html>
	<head>
		<meta charset="UTF-8">
		<title></title>
		<style type="text/css">
			#box{
				width: 300px;
				height: 100px;
				background-color: red;
			}
		</style>
	</head>
	<body>
		<div id="box">
			
		</div>
		<script type="text/javascript">
			var oDiv = document.getElementById("box")
			oDiv.onmousedown = function  () {
				oDiv.style.backgroundColor = "blue"
			}
			oDiv.onmouseup = function  () {
				oDiv.style.backgroundColor = "red"
			}
		</script>
	</body>
</html>
